package test.math.lesson3;

public class Lesson3_1 {


    public static long getNumberOfWheat(int gird) {

       long sum = 0; // 麦粒总数
       long numberOfWheatInGird = 0; // 当前格子的麦粒数

        numberOfWheatInGird = 1; // 第一个格子的麦粒数
        sum += numberOfWheatInGird;


        for (int i = 2; i < gird; i++) {
            numberOfWheatInGird *= 2;
            sum += numberOfWheatInGird;
        }

        return sum;

    }


    public static void main(String[] args) {
        System.out.println(getNumberOfWheat(64));
    }

}
